package model.dao;

import java.sql.PreparedStatement;
import model.Dao;
import model.entity.Proprietario;


public class ProprietarioDAO extends Dao {

  public static Proprietario insert_veiculo(Proprietario prop) {
    try {
      PreparedStatement pstmt = getConnection().prepareStatement(
        "Insert Into veiculo(placa, ano_fabricacao, ano_modelo, cor, marca, modelo, proprietario) "
        + "Values(?, ?, ?, ?, ?, ?, ?)");
      pstmt.setObject(1, prop.getCPF());
      pstmt.setObject(2, prop.getNome());
      pstmt.setObject(3, prop.getRua());
      pstmt.setObject(4, prop.getBairro());
      pstmt.setObject(5, prop.getCEP());
      pstmt.setObject(6, prop.getCidade());
      pstmt.setObject(7, prop.getDtnascimento());
      pstmt.setObject(8, prop.getTelefone());
      pstmt.executeUpdate();
      //

      pstmt.close();
    } catch (Exception e) {

    }
    return prop;
  }

  public static Proprietario update(Proprietario prop) {
    try {
      PreparedStatement pstmt = getConnection().prepareStatement(
        "Update Notas Set Nota = ?, Semestre = ?, Materia = ? "
        + "Where id =?");
      pstmt.setObject(1, prop.getCPF());
      pstmt.setObject(2, prop.getNome());
      pstmt.setObject(3, prop.getRua());
      pstmt.setObject(4, prop.getBairro());
      pstmt.setObject(5, prop.getCEP());
      pstmt.setObject(6, prop.getCidade());
      pstmt.setObject(7, prop.getDtnascimento());
      pstmt.setObject(8, prop.getTelefone());
      pstmt.executeUpdate();
      //
     
      pstmt.close();
    } catch (Exception e) {

    }
 return prop;
  }
}